package com.example.springstudy.utils;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

public class DateUtils {

    public static Date defaultDate(){
        LocalDateTime now = LocalDateTime.now();
        return new Date(now.atZone(ZoneId.of("UTC")).toInstant().toEpochMilli());
    }

    public static Date expireDate(int seconds){
        LocalDateTime now = LocalDateTime.now();
        LocalDateTime lastDate = now.plus(Duration.ofSeconds(seconds));
        return Date.from(lastDate.atZone(ZoneId.of("UTC")).toInstant());
    }
}
